class Contact < ActiveRecord::Base

  validates :phone,   presence: true
  validates :fax,     presence: true
  validates :address, presence: true

  scope :by_created_at_desc, -> { order('created_at desc') }

  scope :chinese, ->  { where(language: 1) }

  scope :english, -> { where(language: 2) }

  scope :traditional, ->  { where(language: 3) }

  scope :language, -> (language) { where(language: language) }
end
